package com.daon.service.impl;

import com.daon.common.RequestHolder;
import com.daon.dao.SysLogMapper;
import com.daon.pojo.SysLog;
import com.daon.pojo.SysLogWithBLOBs;
import com.daon.service.ILogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 1daon
 * @EMAIL 532418116@qq.com
 * @Version 创建时间：2019/1/19 9:55 PM
 * @Modified By
 */
@Service("iLogService")
public class LogServiceImpl implements ILogService{

    @Autowired
    private SysLogMapper sysLogMapper;

    @Override
    public boolean add(SysLogWithBLOBs log) {
        sysLogMapper.insertSelective(log);
        return true;
    }

    @Override
    public PageInfo getSysOperateLogList(int pageNum, int pageSize, String search) {
        //startPage--start
        //填充自己的sql查询逻辑
        //pageHelper--收尾
        PageHelper.startPage(pageNum, pageSize);
        List<SysLog> sysLogs = sysLogMapper.getOperateLogList();
        PageInfo pageResult = new PageInfo(sysLogs);
        pageResult.setList(sysLogs);
        return pageResult;
    }
    @Override
    public PageInfo getSysLogList(int pageNum, int pageSize){
        //startPage--start
        PageHelper.startPage(pageNum, pageSize);
        //填充自己的sql查询逻辑
        List<SysLog> sysLogSiteVoList = sysLogMapper.getLogAllList();
        PageInfo pageResult = new PageInfo(sysLogSiteVoList);
        //pageHelper--收尾
        pageResult.setList(sysLogSiteVoList);
        return pageResult;
    }

}
